package com.gm.hardwarelib.pin;

/**
 * Created by Mouse on 2017/8/19.
 */

public enum NanopcT3XDIO {

    VCC3P3_SYS(1, "VCC3P3_SYS"),

    DGND_1(2, "DGND"),

    UART2_TX(3, "UART2_TX/GPIOD20"),
    GPIOD20(3, "UART2_TX/GPIOD20"),

    UART2_RX(4, "UART2_RX/GPIOD16"),
    GPIOD16(4, "UART2_RX/GPIOD16"),

    I2C0_SCL(5, "I2C0_SCL"),

    I2C0_SDA(6, "I2C0_SDA"),

    SPI0_MOSI(7, "SPI0_MOSI/GPIOC31"),
    GPIOC31(7, "SPI0_MOSI/GPIOC31"),

    SPI0_MISO(8, "SPI0_MISO/GPIOD0"),
    GPIOD0(8, "SPI0_MISO/GPIOD0"),

    SPI0_CLK(9, "SPI0_CLK/GPIOC29"),
    GPIOC29(9, "SPI0_CLK/GPIOC29"),

    SPI0_CS(10, "SPI0_CS/GPIOC30"),
    GPIOC30(10, "SPI0_CS/GPIOC30"),

    UART3_TX(11, "UART3_TX/GPIOD21"),
    GPIOD21(11, "UART3_TX/GPIOD21"),

    UART3_RX(12, "UART3_RX/GPIOD17"),
    GPIOD17(12, "UART3_RX/GPIOD17"),

    UART4_TX(13, "UART4_TX/GPIOB29"),
    GPIOB29(13, "UART4_TX/GPIOB29"),

    UART4_RX(14, "UART4_RX/GPIOB28"),
    GPIOB28(14, "UART4_RX/GPIOB28"),

    UART5_TX(15, "UART5_TX/GPIOB31"),
    GPIOB31(15, "UART5_TX/GPIOB31"),

    UART5_RX(16, "UART5_RX/GPIOB30"),
    GPIOB30(16, "UART5_RX/GPIOB30"),

    GPIOC4(17, "GPIOC4"),

    GPIOC7(18, "GPIOC7"),

    GPIOC8(19, "GPIOC8"),

    GPIOC24(20, "GPIOC24"),

    GPIOC28(21, "GPIOC28"),

    GPIOC26(22, "GPIOC26"),

    GPIOD1(23, "GPIOD1/PWM0"),
    PWM0(23, "GPIOD1/PWM0"),

    GPIOD8(24, "GPIOD8/PPM"),
    PPM(24, "GPIOD8/PPM"),

    GPIOC13(25, "GPIOC13/PWM1"),
    PWM1(25, "GPIOC13/PWM1"),

    AliveGPIO3(26, "AliveGPIO3"),

    GPIOC14(27, "GPIOC14/PWM2"),
    PWM2(27, "GPIOC14/PWM2"),

    AliveGPIO5(28, "AliveGPIO5"),

    VDD_5V(29, "VDD_5V"),

    DGND_2(30, "DGND");

    private int num;
    private String name;

    NanopcT3XDIO(int num, String name) {
        this.num = num;
        this.name = name;
    }

    public static NanopcT3XDIO valueOf(int num) {
        for (NanopcT3XDIO v : NanopcT3XDIO.values()) {
            if (v.num == num) {
                return v;
            }
        }
        throw new IllegalArgumentException();
    }

    public int getNum() {
        return num;
    }

    public String getName() {
        return name;
    }
}
